home *** CD-ROM | disk | FTP | other *** search
/ Chip 2007 January, February, March & April / Chip-Cover-CD-2007-02.iso / Pakiet bezpieczenstwa / mini Pentoo LiveCD 2006.1 / mpentoo-2006.1.iso / livecd.squashfs / usr / lib / mozilla-firefox / include / necko / nsIInputStreamPump.h < prev    next >
C/C++ Source or Header  |  2006-05-08  |  7KB  |  156 lines

  1. /*
  2.  * DO NOT EDIT.  THIS FILE IS GENERATED FROM nsIInputStreamPump.idl
  3.  */
  4.  
  5. #ifndef __gen_nsIInputStreamPump_h__
  6. #define __gen_nsIInputStreamPump_h__
  7.  
  8.  
  9. #ifndef __gen_nsIRequest_h__
  10. #include "nsIRequest.h"
  11. #endif
  12.  
  13. /* For IDL files that don't want to include root IDL files. */
  14. #ifndef NS_NO_VTABLE
  15. #define NS_NO_VTABLE
  16. #endif
  17. class nsIInputStream; /* forward declaration */
  18.  
  19. class nsIStreamListener; /* forward declaration */
  20.  
  21.  
  22. /* starting interface:    nsIInputStreamPump */
  23. #define NS_IINPUTSTREAMPUMP_IID_STR "400f5468-97e7-4d2b-9c65-a82aecc7ae82"
  24.  
  25. #define NS_IINPUTSTREAMPUMP_IID \
  26.   {0x400f5468, 0x97e7, 0x4d2b, \
  27.     { 0x9c, 0x65, 0xa8, 0x2a, 0xec, 0xc7, 0xae, 0x82 }}
  28.  
  29. /**
  30.  * nsIInputStreamPump
  31.  *
  32.  * This interface provides a means to configure and use a input stream pump
  33.  * instance.  The input stream pump will asynchronously read from a input
  34.  * stream, and push data to a nsIStreamListener instance.  It utilizes the 
  35.  * current thread's nsIEventTarget in order to make reading from the stream
  36.  * asynchronous.
  37.  *
  38.  * If the given stream supports nsIAsyncInputStream, then the stream pump will
  39.  * call the stream's AsyncWait method to drive the stream listener.  Otherwise,
  40.  * the stream will be read on a background thread utilizing the stream
  41.  * transport service.  More details are provided below.
  42.  */
  43. class NS_NO_VTABLE nsIInputStreamPump : public nsIRequest {
  44.  public: 
  45.  
  46.   NS_DEFINE_STATIC_IID_ACCESSOR(NS_IINPUTSTREAMPUMP_IID)
  47.  
  48.   /**
  49.      * Initialize the input stream pump.
  50.      *
  51.      * @param aStream
  52.      *        contains the data to be read.  if the input stream is non-blocking,
  53.      *        then it will be QI'd to nsIAsyncInputStream.  if the QI succeeds
  54.      *        then the stream will be read directly.  otherwise, it will be read
  55.      *        on a background thread using the stream transport service.
  56.      * @param aStreamPos
  57.      *        specifies the stream offset from which to start reading.  the
  58.      *        offset value is absolute.  pass -1 to specify the current offset.
  59.      *        NOTE: this parameter is ignored if the underlying stream does not
  60.      *        implement nsISeekableStream.
  61.      * @param aStreamLen
  62.      *        specifies how much data to read from the stream.  pass -1 to read
  63.      *        all data available in the stream.
  64.      * @param aSegmentSize
  65.      *        if the stream transport service is used, then this parameter
  66.      *        specifies the segment size for the stream transport's buffer.
  67.      *        pass 0 to specify the default value.
  68.      * @param aSegmentCount
  69.      *        if the stream transport service is used, then this parameter
  70.      *        specifies the segment count for the stream transport's buffer.
  71.      *        pass 0 to specify the default value.
  72.      * @param aCloseWhenDone
  73.      *        if true, the input stream will be closed after it has been read.
  74.      */
  75.   /* void init (in nsIInputStream aStream, in long long aStreamPos, in long long aStreamLen, in unsigned long aSegmentSize, in unsigned long aSegmentCount, in boolean aCloseWhenDone); */
  76.   NS_IMETHOD Init(nsIInputStream *aStream, PRInt64 aStreamPos, PRInt64 aStreamLen, PRUint32 aSegmentSize, PRUint32 aSegmentCount, PRBool aCloseWhenDone) = 0;
  77.  
  78.   /**
  79.      * asyncRead causes the input stream to be read in chunks and delivered
  80.      * asynchronously to the listener via OnDataAvailable.
  81.      *
  82.      * @param aListener
  83.      *        receives notifications.
  84.      * @param aListenerContext
  85.      *        passed to listener methods.
  86.      */
  87.   /* void asyncRead (in nsIStreamListener aListener, in nsISupports aListenerContext); */
  88.   NS_IMETHOD AsyncRead(nsIStreamListener *aListener, nsISupports *aListenerContext) = 0;
  89.  
  90. };
  91.  
  92. /* Use this macro when declaring classes that implement this interface. */
  93. #define NS_DECL_NSIINPUTSTREAMPUMP \
  94.   NS_IMETHOD Init(nsIInputStream *aStream, PRInt64 aStreamPos, PRInt64 aStreamLen, PRUint32 aSegmentSize, PRUint32 aSegmentCount, PRBool aCloseWhenDone); \
  95.   NS_IMETHOD AsyncRead(nsIStreamListener *aListener, nsISupports *aListenerContext); 
  96.  
  97. /* Use this macro to declare functions that forward the behavior of this interface to another object. */
  98. #define NS_FORWARD_NSIINPUTSTREAMPUMP(_to) \
  99.   NS_IMETHOD Init(nsIInputStream *aStream, PRInt64 aStreamPos, PRInt64 aStreamLen, PRUint32 aSegmentSize, PRUint32 aSegmentCount, PRBool aCloseWhenDone) { return _to Init(aStream, aStreamPos, aStreamLen, aSegmentSize, aSegmentCount, aCloseWhenDone); } \
  100.   NS_IMETHOD AsyncRead(nsIStreamListener *aListener, nsISupports *aListenerContext) { return _to AsyncRead(aListener, aListenerContext); } 
  101.  
  102. /* Use this macro to declare functions that forward the behavior of this interface to another object in a safe way. */
  103. #define NS_FORWARD_SAFE_NSIINPUTSTREAMPUMP(_to) \
  104.   NS_IMETHOD Init(nsIInputStream *aStream, PRInt64 aStreamPos, PRInt64 aStreamLen, PRUint32 aSegmentSize, PRUint32 aSegmentCount, PRBool aCloseWhenDone) { return !_to ? NS_ERROR_NULL_POINTER : _to->Init(aStream, aStreamPos, aStreamLen, aSegmentSize, aSegmentCount, aCloseWhenDone); } \
  105.   NS_IMETHOD AsyncRead(nsIStreamListener *aListener, nsISupports *aListenerContext) { return !_to ? NS_ERROR_NULL_POINTER : _to->AsyncRead(aListener, aListenerContext); } 
  106.  
  107. #if 0
  108. /* Use the code below as a template for the implementation class for this interface. */
  109.  
  110. /* Header file */
  111. class nsInputStreamPump : public nsIInputStreamPump
  112. {
  113. public:
  114.   NS_DECL_ISUPPORTS
  115.   NS_DECL_NSIINPUTSTREAMPUMP
  116.  
  117.   nsInputStreamPump();
  118.  
  119. private:
  120.   ~nsInputStreamPump();
  121.  
  122. protected:
  123.   /* additional members */
  124. };
  125.  
  126. /* Implementation file */
  127. NS_IMPL_ISUPPORTS1(nsInputStreamPump, nsIInputStreamPump)
  128.  
  129. nsInputStreamPump::nsInputStreamPump()
  130. {
  131.   /* member initializers and constructor code */
  132. }
  133.  
  134. nsInputStreamPump::~nsInputStreamPump()
  135. {
  136.   /* destructor code */
  137. }
  138.  
  139. /* void init (in nsIInputStream aStream, in long long aStreamPos, in long long aStreamLen, in unsigned long aSegmentSize, in unsigned long aSegmentCount, in boolean aCloseWhenDone); */
  140. NS_IMETHODIMP nsInputStreamPump::Init(nsIInputStream *aStream, PRInt64 aStreamPos, PRInt64 aStreamLen, PRUint32 aSegmentSize, PRUint32 aSegmentCount, PRBool aCloseWhenDone)
  141. {
  142.     return NS_ERROR_NOT_IMPLEMENTED;
  143. }
  144.  
  145. /* void asyncRead (in nsIStreamListener aListener, in nsISupports aListenerContext); */
  146. NS_IMETHODIMP nsInputStreamPump::AsyncRead(nsIStreamListener *aListener, nsISupports *aListenerContext)
  147. {
  148.     return NS_ERROR_NOT_IMPLEMENTED;
  149. }
  150.  
  151. /* End of implementation class template. */
  152. #endif
  153.  
  154.  
  155. #endif /* __gen_nsIInputStreamPump_h__ */
  156.